import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FlathistoryRentalVO, FlathistoryRentalForm, FlathistoryRentalQuery } from '@/api/zichanguanli/flathistoryRental/types';

/**
 * 查询公寓历史租赁列表
 * @param query
 * @returns {*}
 */

export const listFlathistoryRental = (query?: FlathistoryRentalQuery): AxiosPromise<FlathistoryRentalVO[]> => {
  return request({
    url: '/zichanguanli/flathistoryRental/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询公寓历史租赁详细
 * @param id
 */
export const getFlathistoryRental = (id: string | number): AxiosPromise<FlathistoryRentalVO> => {
  return request({
    url: '/zichanguanli/flathistoryRental/' + id,
    method: 'get'
  });
};

/**
 * 新增公寓历史租赁
 * @param data
 */
export const addFlathistoryRental = (data: FlathistoryRentalForm) => {
  return request({
    url: '/zichanguanli/flathistoryRental',
    method: 'post',
    data: data
  });
};

/**
 * 修改公寓历史租赁
 * @param data
 */
export const updateFlathistoryRental = (data: FlathistoryRentalForm) => {
  return request({
    url: '/zichanguanli/flathistoryRental',
    method: 'put',
    data: data
  });
};

/**
 * 删除公寓历史租赁
 * @param id
 */
export const delFlathistoryRental = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/flathistoryRental/' + id,
    method: 'delete'
  });
};
